<!DOCTYPE html>
<html>

<head lang="en">
    <title>首页</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css">
    <link rel="stylesheet" href="/css/reset.css" rel="stylesheet">
    <link rel="stylesheet" href="/css/index.css" rel="stylesheet">
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <script src="/js/common.js"></script>
    <script src="/js/queryAndBlank.js"></script>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script>
        $(function () {
            $.get(baseUrl + '/travelCommends', {type: 1, pageSize: 3}, function (data) {
                console.log(data);
                $('#travelsCommends').renderValues(data, {
                    getHref: getHref
                });
                $('.carousel-item:first').addClass('active');
            })

            $.get(baseUrl + '/dailies/selectHotDaily.do', {sequence: 1}, function (data) {
                $("#bigger").renderValues(data, {

                    getHref:getHref
                })
            })
            $.get(baseUrl + '/dailies/list.do', {pageSize: 2}, function (data) {
                $('#smaller').renderValues(data, {
                    getHref:getHref
                })
            })
            //全局搜索
            $("#searchBtn").click(function () {
                var keyword = $("#searchInp").val()
                if (keyword == null || keyword == "") {
                    $(document).dialog({
                        titleText: '温馨提示',
                        content: '搜索内容不能为空!',
                    });
                } else {

                    window.location.href = "/searchPage.html?keyword=" + keyword + ""
                }
            })
            //点评头条
            $.get(baseUrl + "/comments/HotCommentList", function (data) {
                $("#hotComment").renderValues({list: data}, {
                    //个人主页
                    getHref:getHref,
                    //点评类型网址--href
                    getCommentHref: function (item, value) {
                        var articleId = $(item).siblings(".article").data("id")
                        console.log("获取评论文章id");
                        console.log(articleId);
                        if (value == 1) {//游记
                            $(item).attr("href", "/mine/travelComment.html?id=" + articleId);
                        } else if (value == 2) {//攻略
                            $(item).attr("href", "/mine/strategyDetailComment.html?id=" + articleId);
                        } else if (value == 3) {//日报
                            $(item).attr("href", "/mine/dailyComment.html?id=" + articleId);
                        } else {//点评
                            $(item).attr("href", "/mine/strategyComment.html?id=" + articleId);
                        }
                    },
                    getCommentType: function (item, value) {
                       $(item).html(value);
                    }
                })

            })


        });
    </script>
</head>
<body>
<div class="body">
    <input type="checkbox" id="menu">
    <label for="menu" class="menu">
        <span><i class="fa fa-user fa-fw fa-2x"></i></span>
        <span><i class="fa fa-chevron-left fa-fw fa-2x" style="color: #3E3C3B"></i></span>
    </label>
    <!-- 侧边栏 -->
    <div class="nav">
        <iframe id="ipage" src="/mine/simpleProfiles.html" frameborder="0" width="90%"></iframe>
    </div>
    <div class="search-head">
        <div class="row nav-search">
            <div class="col-1"></div>
            <div class="col-9">
                <div class="input-group-sm search">
                    <input id="searchInp" class="form-control" placeholder="搜索攻略\游记\日报">
                </div>
            </div>
            <div class="col-1">
                <i class="fa fa-search" id="searchBtn"
                   style="color:white;font-size:25px;position: absolute;top: 23%;left: 88%">
                </i>
            </div>
        </div>
    </div>
    <div class="container">
        <h6 class="module-title">每周推荐</h6>
        <div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
            <div id="travelsCommends">
                <div class="carousel-inner" render-loop="list">
                    <div class="carousel-item">
                        <a render-fun="getHref" render-key="list.travelId" data-url="/travelContent.html?id=">
                            <img class="d-block w-100" render-src="list.coverUrl" width="100%" height="200px">
                            <span class="recommend" render-html="list.title"></span></a>
                        <div class="recommend-author"><a render-fun="getHref" render-key="list.userId"
                                                         data-url="/userProfiles.html?id=">
                            <img class="rounded-circle" style="width: 10%;" render-src="list.userHeadImgUrl">
                            <span render-html="list.userNickName"></span>
                        </a>在&nbsp;
                            <span render-html="list.regionName"></span>
                        </div>
                    </div>
                </div>
            </div>
            <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
                <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                <span class="sr-only"></span>
            </a>
            <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
                <span class="carousel-control-next-icon" aria-hidden="true"></span>
                <span class="sr-only"></span>
            </a>
        </div>

        <hr>

        <div class="row nav-box">
            <div class="col" style="background-color: #f5c6cb;" align="center">
                <a href="strategyPage.html"><i class="fa fa-plane fa-fw"></i> 找攻略</a>
            </div>
            <div class="col" style="background-color: #7281D5;" align="center">
                <a href="travelPage.html"><i class="fa fa-eye" aria-hidden="true"></i> 看游记</a>
            </div>
        </div>
        <div class="row nav-box">
            <div class="col" style="background-color: #F7E21C;" align="center">
                <a href="/question.html"><i class="fa fa-question-circle" aria-hidden="true"></i> 问达人</a>
            </div>
            <div class="col" style="background-color: #71dd8a;" align="center">
                <a href="/mine/store.html"><i class="fa fa-shopping-cart"></i> 逛商城</a>
            </div>
        </div>
        <div class="row nav-box">
            <div class="col" style="background-color:dodgerblue;" align="center">
                <a href="grogshop.html"><i class="fa fa-university fa-fw"></i> 找酒店</a>
            </div>
        </div>
        <div class="row dynamic " id="comments">
            <div class="col-1" style="padding: 0px;">
                <img class="rounded" src="/img/topComment.png" style="width: 50px;">
            </div>
            <div class="col" id="hotComment">
                <div class="Marquee" render-loop="list">
                    <!--循环-->
                    <div class="d-flex">
                        <a data-url="userProfiles.html?id=" render-key="list.user.id" render-fun="getHref">
                            <img class="rounded-circle dynamic-head"
                                 render-src="list.user.headImgUrl">
                        </a>
                        <p class="article" render-attr="data-id=list.article.id" hidden ></p>
                        <a class="dynamic-detail"
                           render-key="list.modelState" render-fun="getCommentHref">

                            <span render-html="list.user.nickName" style="color: #FF5722">叩丁狼</span>&nbsp;刚刚点评了<p
                                render-key="list.article.title" render-fun="getCommentType" style="color: #00bbd3">广州攻略</p>
                        </a>
                    </div>
                    <!--循环-->
                </div>
            </div>
        </div>
    </div>

    <hr>

    <div class="container">
        <h6 class="module-title">骡窝日报 <a href="/daily.html">更多</a></h6>
        <div class="news " id="bigger">
            <a data-url="/dailyContent.html?id=" render-key="id" render-fun="getHref">
                <img width="100%" render-src="coverUrl">
                <div class="caption">
                    <h5 render-html="title">暑假去哪里旅游凉快？</h5>
                    <span class="fl-r">
                浏览量:&nbsp;&nbsp;<b style="font-size: 15px;" render-html="browseNum">730</b>
                &nbsp;&nbsp;&nbsp;&nbsp;by&nbsp;<b style="font-size: 15px;">骡窝窝官方</b>
            </span>
                </div>
            </a>
        </div>

        <hr>
        <div id="smaller">
            <div render-loop="list">
                <div style="margin-bottom: 20px">
                    <a data-url="/dailyContent.html?id=" render-key="list.id" render-fun="getHref">
                        <div class="row news-detail">
                            <div class="col-5">
                                <img render-src="list.coverUrl">
                            </div>
                            <div class="col-7">
                                <h4 render-html="list.title">全球最性感的海滩！</h4>

                                <span class="fl-r">
                浏览量:&nbsp;<b style="font-size: 15px;" render-html="list.browseNum">730</b>
                by<b style="font-size: 15px;">骡窝窝官方</b>
            </span>
                            </div>
                        </div>
                    </a>
                    <hr>
                </div>
            </div>
        </div>
    </div>
</div>
<script>

    $(function () {
        showComments();
    })

    function showComments() {
        var Mar = document.getElementsByClassName("Marquee")[0];
        var child_div = Mar.getElementsByTagName("div");
        var picH = 50;//移动高度
        var scrollstep = 3;//移动步幅,越大越快
        var scrolltime = 20;//移动频度(毫秒)越大越慢
        var stoptime = 3000;//间断时间(毫秒)
        var tmpH = 0;
        Mar.innerHTML += Mar.innerHTML;

        function start() {
            if (tmpH < picH) {
                tmpH += scrollstep;
                if (tmpH > picH) tmpH = picH;
                Mar.scrollTop = tmpH;
                setTimeout(start, scrolltime);
            } else {
                tmpH = 0;
                Mar.appendChild(child_div[0]);
                Mar.scrollTop = 0;
                setTimeout(start, stoptime);
            }
        }

        setTimeout(start, stoptime)
    }
</script>
</body>

</html>